package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.StandardSynTotal;
import com.ruoyi.system.service.IStandardSynTotalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * StandardTotalController
 * 
 * @author ruoyi
 * @date 2025-06-23
 */
@RestController
@RequestMapping("/system/standardTotal")
public class StandardSynTotalController extends BaseController
{
    @Autowired
    private IStandardSynTotalService standardSynTotalService;

    /**
     * 查询StandardTotal列表
     */
    @PreAuthorize("@ss.hasPermi('system:standardTotal:list')")
    @GetMapping("/list")
    public TableDataInfo list(StandardSynTotal standardSynTotal)
    {
        startPage();
        List<StandardSynTotal> list = standardSynTotalService.selectStandardSynTotalList(standardSynTotal);
        return getDataTable(list);
    }

    /**
     * 导出StandardTotal列表
     */
    @PreAuthorize("@ss.hasPermi('system:standardTotal:export')")
    @Log(title = "StandardTotal", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StandardSynTotal standardSynTotal)
    {
        List<StandardSynTotal> list = standardSynTotalService.selectStandardSynTotalList(standardSynTotal);
        ExcelUtil<StandardSynTotal> util = new ExcelUtil<StandardSynTotal>(StandardSynTotal.class);
        util.exportExcel(response, list, "StandardTotal数据");
    }

    /**
     * 获取StandardTotal详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:standardTotal:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(standardSynTotalService.selectStandardSynTotalById(id));
    }

    /**
     * 新增StandardTotal
     */
    @PreAuthorize("@ss.hasPermi('system:standardTotal:add')")
    @Log(title = "StandardTotal", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StandardSynTotal standardSynTotal)
    {
        return toAjax(standardSynTotalService.insertStandardSynTotal(standardSynTotal));
    }

    /**
     * 修改StandardTotal
     */
    @PreAuthorize("@ss.hasPermi('system:standardTotal:edit')")
    @Log(title = "StandardTotal", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StandardSynTotal standardSynTotal)
    {
        return toAjax(standardSynTotalService.updateStandardSynTotal(standardSynTotal));
    }

    /**
     * 删除StandardTotal
     */
    @PreAuthorize("@ss.hasPermi('system:standardTotal:remove')")
    @Log(title = "StandardTotal", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(standardSynTotalService.deleteStandardSynTotalByIds(ids));
    }
}
